/*
 * Created: Author: Aléx Carvalho / Date: Jan 23, 2015
 * 
 * Changed: $Author: ac280593@gmail.com $ / $Date: 2015-06-04 21:24:45 -0300 (Thu, 04 Jun 2015) $
 */

package com.cpm.entities;

import com.cpm.entities.id.IntegerId;
import com.cpm.wrapper.Email;
import com.cpm.entities.types.Family;
import com.cpm.wrapper.Password;
import com.cpm.wrapper.Phone;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Transient;

@Entity
public class User extends IntegerId implements Identity<User> {
    private static final long serialVersionUID = -6228081208128545534L;

    @Column(length = 200, nullable = false)
    private String name;
    
    @Column(length = 50, nullable = false, unique = true)
    private String login;
    
    private Password password;
    
    private Phone phone;
    
    private Email email;
    
    @Transient
    private Information information;
    
    public User() {}

    public User(String name, String login, Information information, Password password, Phone phone, Email email) {
        this.name = name;
        this.login = login;
        this.information = information;
        this.password = password;
        this.phone = phone;
        this.email = email;
    }

    public String getName() {
        return name;
    }

    public String getLogin() {
        return login;
    }
    
    public Information getInformation() {
        return information;
    }

    public Password getPassword() {
        return password;
    }

    public Phone getPhone() {
        return phone;
    }

    public Email getEmail() {
        return email;
    }
    
    @Override
    public Family getFamily() { return Family.USER; }

    @Override
    public String toString() { return name; }

    @Override
    public User clone() {
        return null;
    }
}